<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
  String _id=request.getParameter("_");
%>


      <form id="form_stepCon_input" class="form-horizontal">
        <input type="hidden" name="parentId" id="parentId" value="${stepCon.stepBrief.id}" />
        <input type="hidden" name="keyId" id="keyId" value="${stepCon.id}" />

        <div class="form-group">
          <label class="col-md-2 control-label">条件名称<i class="fa fa-asterisk txt-color-red"></i></label>
          <div class="col-md-6">
              <input class="form-control" type="text"  name="stepName" id="stepName"  placeholder="请输入条件名称"
                     value="${stepCon.name}" />
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label">条件描述</label>
          <div class="col-md-6">
            <input class="form-control" type="text" name="content" id="content" placeholder="请输入条件描述"
                   value="${stepCon.content}" />
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label">
            条件公式<i class="fa fa-asterisk txt-color-red"></i>
          </label>
          <div class="col-md-3">
            <select  name="formulaField" id="formulaField" class="form-control">
              <option value="">--请选择--</option>
              <c:forEach var="item" items="${fieldNames}" varStatus="status">
                <option value="${item}" <c:if test="${item == stepCon.formulaField}"> selected</c:if>>${item}</option>
              </c:forEach>
            </select>
          </div>
          <div class="col-md-2">
              <select class="form-control" name="formulaFlag" id="formulaFlag">
                <option value="">--请选择--</option>
                <option value=">" <c:if test='${">"==stepCon.formulaFlag}'>selected</c:if>>大于</option>
                <option value=">=" <c:if test='${">="==stepCon.formulaFlag}'>selected</c:if>>大于等于</option>
                <option value="==" <c:if test='${"=="==stepCon.formulaFlag}'>selected</c:if>>等于</option>
                <option value="<" <c:if test='${"<"==stepCon.formulaFlag}'>selected</c:if>>小于</option>
                <option value="<=" <c:if test='${"<="==stepCon.formulaFlag}'>selected</c:if>>小于等于</option>
                <option value="!=" <c:if test='${"!="==stepCon.formulaFlag}'>selected</c:if>>不等于</option>
              </select>
          </div>
          <div class="col-md-3">
              <input type="text" name="formulaVal" id="formulaVal" placeholder="请输入条件值" class="form-control" value="${stepCon.formulaVal}" >
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label">
            对应步骤编号<i class="fa fa-asterisk txt-color-red"></i>
          </label>
          <div class="col-md-6">
              <input type="text" name="stepNo" id="stepNo" placeholder="请输入对应步骤编号" class="form-control" value="${stepCon.stepNo}" >
          </div>
        </div>
      </form>








<script>

  $(function(){
      fn_stepCon_input_validate();
  });



  // 表单数据校验
  function fn_stepCon_input_validate() {
    __init_validate('form_stepCon_input', {
        rules : {
            stepName : {
                required : true
            },
            formulaField : {
                required : true
            },
            formulaFlag : {
                required : true
            },
            formulaVal: {
                required : true
            },
            stepNo : {
                required : true
            }
        },
        messages : {
            stepName : {
                required : "请输入条件名称"
            },
            formulaField : {
                required : "请选择条件域名"
            },
            formulaFlag : {
                required : "请选择条件符号"
            },
            formulaVal: {
                required : "请输入条件值"
            },
            stepNo : {
                required : "请输入对应步骤编号"
            }
        }
    });
  }

  function fn_stepCon_save(callback) {
      if (!$('#form_stepCon_input').valid()) {
          return false;
      }
      __confirm_dialog(null, '确定提交么?',
          function () {
              __form_save('form_stepCon_input', '<%=path%>/main/stepCon/save', function(data){
                  if(data.state == 1){
                      callback(data);
                  } else {
                      callback();
                  }
              });
          },
          function () {
              callback();
          }
      );
  }

</script>